/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sv.com.globalsolutionslt.controlador;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import sv.com.globalsolutionslt.entidades.TipoEstudio;

/**
 *
 * @author karinaMelara
 */
@Stateless
public class TipoEstudioFacade extends AbstractFacade<TipoEstudio> {

    @PersistenceContext(unitName = "BoldeDeTrabajoPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public TipoEstudioFacade() {
        super(TipoEstudio.class);
    }

    public List<TipoEstudio> TipoEstudioActivo() {
        List<TipoEstudio> tipoEstudio = null;
        try {
            String sql = "SELECT t FROM TipoEstudio t where t.activo=" + true;
            Query q = em.createQuery(sql);
            tipoEstudio = q.getResultList();
        } catch (NoResultException e) {
            System.out.println("Sin resultados");
        }
        return tipoEstudio;
    }

}
